﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;

namespace AlarmClockConsoleApp
{
    public delegate void BellEventHandler(object sender, BellEventArgs e);

    public delegate void TickEventHandler(object sender, BellEventArgs e);
    /// <summary>
    /// 闹铃事件参数类
    /// </summary>
    public class BellEventArgs : EventArgs
    {
        public int Hour { get; }
        public int Minute { get; }
        public int Second { get; }
        public string BellWord { get; }
        public BellEventArgs(int hour, int minute, int second, string bellWord)
        {
            Hour = hour;
            Minute = minute;
            Second = second;
            BellWord = bellWord;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            AlarmClock alarmClock = new AlarmClock();

            alarmClock.SetBellTime(17, 40, 30);
            alarmClock.BellEvent += new BellEventHandler(Alarm);
            alarmClock.TickEvent += new TickEventHandler(Tick);
            alarmClock.StartBell();
        }

        /// <summary>
        /// 响铃（Alarm）事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Alarm(object sender, BellEventArgs e)
        {
            string bellMsg = string.Format("{0}时{1}分{2}秒-->{3}", e.Hour, e.Minute, e.Second, e.BellWord);
            Console.WriteLine(bellMsg);
            
            Console.Read();
        }

        /// <summary>
        /// 嘀嗒（Tick）事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Tick(object sender, BellEventArgs e)
        {
            string bellMsg = "嘀嗒";
            Console.WriteLine(bellMsg);

            //Console.Read();
        }
    }

   
}
